<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">

    <title>
        比赛报名系统
    </title>

    <!-- CSS  -->
    <!--<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">-->
    <link href="/bm/Public/css/Mi.css" type="text/css" rel="stylesheet" media="screen,projection"/>
    <link href="/bm/Public/css/materialize.min.css" type="text/css" rel="stylesheet" media="screen,projection"/>
    <link href="/bm/Public/css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
    
    <link rel="stylesheet" href="/bm/Public/css/top.css">


</head>
<body>
<nav class="blue" role="navigation">
    <div class="nav-wrapper container"><img class="z-depth-2 hide-on-med-and-down circle responsive-img" src="/bm/Public/images/logo3.jpg" width="50px"
                                            style="margin:5px;border-radius:50%"><a id="logo-container"
                                                                                    href="<?php echo U('Index/index');?>"
                                                                                    class="brand-logo">比赛报名系统</a>
        <ul class="right hide-on-med-and-down">
            <li><a href="<?php echo U('Index/index');?>">首页</a></li>
            <?php if(session('?stuid')): ?><li><a href="<?php echo U('UserInfo/index');?>">报名详情</a></li>
                <li><a class="dropdown-button" href="#!" data-activates="dropdown1"><?php echo session("stuid");?><i
                        class="mdi-navigation-arrow-drop-down right"></i></a></li>
                <li><a class="waves-effect waves-light btn red" href="<?php echo U('Login/logout');?>">退出</a></li>
                <?php else: ?>
                <li><a class="waves-effect waves-light btn red" href="<?php echo U('Login/index');?>">登录</a></li><?php endif; ?>
        </ul>
        <!-- Dropdown Structure -->
        <ul id="dropdown1" class="dropdown-content z-depth-2" style="margin-top: 70px;">
            <li><a href="<?php echo U('Home/UserInfo/changePwd');?>">修改密码</a></li>
            <!--<li><a href="#!">我的收藏</a></li>-->
        </ul>
        <ul id="nav-mobile" class="side-nav">
            <li><a href="<?php echo U('Index/index');?>">首页</a></li>

            <?php if(session('?stuid')): ?><li><a href="<?php echo U('Index/index');?>"><?php echo ($_SESSION["stuid"]); ?></a></li>
                <li><a href="<?php echo U('Home/UserInfo/index');?>">报名详情</a></li>
                <li><a href="<?php echo U('Home/UserInfo/changePwd');?>">修改密码</a></li>
                <li><a href="<?php echo U('Home/Login/logout');?>">退出</a></li>
                <?php else: ?>
                <li><a href="<?php echo U('Home/Login/index');?>">登录</a></li><?php endif; ?>
        </ul>
        <a href="#" data-activates="nav-mobile" class="button-collapse"><i class="material-icons">menu</i></a>
    </div>
</nav>

    <div class="container">

        <div class="section" id="mysec">
            <a href="#0" class="cd-top">Top</a>
            <div class="row">
                <div class="input-field col s12">
                    <a class="btn dropdown-button col s12 green lighten-1" href="#!" data-activates="dropdown2">
                        <?php if(!empty($_GET['deptid'])): if(($_GET['deptid']) == "0"): ?>所有部门赛项
                                <?php else: ?>
                                <?php echo getDeptName($_GET['deptid']); endif; ?>
                            <?php else: ?>
                            所有部门赛项<?php endif; ?>
                        <i class="mdi-navigation-arrow-drop-down right"></i>
                    </a>
                    <ul id="dropdown2" class="dropdown-content">
                        <li><a href="<?php echo U('Home/Index/index',array('deptid'=>'0'));?>">所有部门赛项</a></li>
                        <?php $_result=getDept();if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li><a href="<?php echo U('Home/Index/index',array('deptid'=>$vo['did']));?>"><?php echo ($vo["name"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
                    </ul>
                </div>
            </div>
            <?php if(is_array($res)): $i = 0; $__LIST__ = $res;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class="row">
                    <div class="col s12">
                        <div class="card-panel hoverable">

                                <div class="left">
                                    <h5>
                                        <a href="<?php echo U('Details/index',array('enid'=>$vo['enid']));?>">
                                            <?php if(($vo["enclass"]) == "1"): ?>『个人』
                                                <?php else: ?>
                                                『团体』<?php endif; ?>
                                            <?php echo ($vo["title"]); ?>
                                        </a>
                                    </h5>
                                </div>
                            <div class="right">报名截止时间：<span
                                        class="center-aligne" style="color: red"><?php echo date("Y-m-d",$vo["start"]);?>~<?php echo date("Y-m-d",$vo["end"]);?></span>
                                </div>
                                <div class="clearfix"></div>

                            <div class="valign">
                                <p>&emsp;&emsp;
                                    <?php echo mb_substr(trim(strip_tags($vo["content"])),0,140,'utf-8');?>
                                    ……
                                </p>
                            </div>

                            <div class="left" style="color: gray">发布时间：<span
                                    class="mui--divider-right"><?php echo date("Y-m-d",$vo["addtime"]);?>&nbsp;</span>
                                <?php if(($vo["enclass"]) == "1"): ?>&nbsp;报名人数：
                                    <?php else: ?>
                                    &nbsp;报名团队数：<?php endif; ?>
                                <span><?php echo sumPeo($vo['enid'],$vo['enclass']);?>/<?php echo ($vo["num"]); ?></span>&nbsp;负责老师：<span><?php echo ($vo["pri"]); ?></span>
                                &nbsp;所属部门：<span><?php echo getDeptName($vo['deptid']);?></span>
                            </div>

                            <div class="right">
                                <?php if(Is_Enrolled($_SESSION['stuid'],$vo['enclass'],$vo['enid']) > 0 ): ?><a class="waves-effect waves-light btn disabled red">已报名</a>
                                    <?php else: ?>
                                    <?php if(sumPeo($vo['enid'],$vo['enclass']) < $vo['num'] ): if(time() < ($vo['end']+86400) ): if(($vo["enclass"]) == "1"): ?><a class="waves-effect waves-light btn red"
                                                   href="<?php echo U('Stuform/oneAdd',array('enid'=>$vo['enid']));?>"
                                                   onclick="if(confirm('确定报名吗?')==false)return false;">报名</a>
                                                <!--<a class="waves-effect waves-light btn disabled red" href="#">报名</a>-->
                                                <?php else: ?>
                                                <a class="waves-effect waves-light btn red"
                                                   href="<?php echo U('Stuform/team',array('enid'=>$vo['enid']));?>">报名</a>
                                                <!--<a class="waves-effect waves-light btn disabled red"-->
                                                <!--href="#">报名</a>--><?php endif; ?>
                                            <?php else: ?>
                                            <a class="waves-effect waves-light btn disabled red">报名已过期</a><?php endif; ?>
                                        <?php else: ?>
                                        <a class="waves-effect waves-light btn disabled red">报名已满</a><?php endif; endif; ?>

                                <a class="waves-effect waves-light btn  green"
                                   href="<?php echo U('Details/index',array('enid'=>$vo['enid']));?>">查看详情</a>
                            </div>
                            <div class="clearfix"></div>


                        </div>
                    </div>
                </div><?php endforeach; endif; else: echo "" ;endif; ?>


            <ul class="pagination center">
                <?php echo ($page); ?>
            </ul>
        </div>


    </div>


<div class="clearfix"></div>

<footer class="page-footer blue" style="padding-top: 0px;">
    <div class="footer-copyright">
        <div class="container center">
            © 2016 广西水利电力职业技术学院<a class="orange-text text-lighten-3" href="#">敏捷软件协会</a>
        </div>
    </div>
</footer>
<script type="text/javascript" src="/bm/Public/js/jquery.js"></script>
<script src="/bm/Public/js/jquery-ui.js"></script>
<script src="/bm/Public/js/materialize.js"></script>
<script src="/bm/Public/js/init.js"></script>


    <script>
        $(document).ready(function () {
            $('select').material_select();
        });
    </script>
    <script src="/bm/Public/js/top.js"></script> <!-- Gem jQuery -->

</body>

</html>

</html>